<!DOCTYPE html>
<html class="x-admin-sm">
{include file='public/header'}
<style>
    .layui-form-label{width: 180px;}
    .layui-input-block{margin-left: 210px;}
</style>
<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="javascript:void(0)">首页</a>
            <a href="javascript:void(0)">投手管理</a>
            <a><cite>回传设置</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" id="reload" title="刷新">
            <i class="layui-icon" style="line-height:30px"><i class="iconfont">&#xe6aa;</i></i>
        </a>
    </div>
    <div class="x-body">
        <div class="layui-tab" lay-filter="tableType" style="margin-top:0px;margin-bottom:20px">
            <ul class="layui-tab-title">
                <li class="layui-this">抖音回传设置</li>
            </ul>
        </div>

        <form class="layui-form" lay-filter="formAjax">
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>抖音资产化回传地址
                </label>
                <div class="layui-input-block">
                    <input type="text" name="tiktok_back_url" placeholder="抖音资产化回传地址" required="required" lay-verify="required" autocomplete="off" class="layui-input" value="" />
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">
                    <span class="x-red">*</span>抖音资产化回传token
                </label>
                <div class="layui-input-block">
                    <input type="text" name="tiktok_back_token" placeholder="抖音资产化回传token" required="required" lay-verify="required" autocomplete="off" class="layui-input" value="" />
                </div>
            </div>
           
            <button id="submitData" class="layui-btn" lay-submit lay-filter="submitData" style="margin-left: 210px;">保存</button>
        </form>
    </div>
    <script>
        let params = {
            editUrl: '/cps/pitcher/backSetting',
            detailUrl: '/cps/pitcher/getBackSetSetting',
        }
        layui.use(["form", "layer"], function () {
            var form = layui.form,
                layer = layui.layer;
            Ajax(params.detailUrl,{},'get').then(result =>{
                form.val("formAjax",result.data);
            });
            form.on('submit(submitData)', function(data){
                var formData = data.field
                let url = params.editUrl
                Ajax(url,formData).then(data =>{
                    if (data.code === 200) {
                        layer.msg(data.message, {
                            icon: 6
                        });
                    }
                });
                return false
            });
        })

    </script>
</body>

</html>